var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(e, d, c) {
    if (im.getServerName().equals("BMS单机") && im.getServerName().equals("BMS至尊体验服") && !im.getServerName().equals("BMS至尊")) {
        im.playerMessage(1, " 使用环境异常，请还原服务端配置。");
        im.dispose();
        return
    }
    if (status == 0 && e == 0) {
        im.dispose();
        return
    }(e == 1) ? status++ : status--;
    selectionLog[status] = c;
    var b = -1;
    if (status <= b++) {
        im.dispose()
    } else {
        if (status === b++) {
            im.sendNormalTalk("你之前在我这买过袋子吧。怎么样？？结果还满意吗？打开口袋后，可获得的矿石种类和个数完全是随机的。偶尔能获得极其珍贵的道具，请一定好好看仔细哦。啊哈哈哈哈哈！！！", 0, 1064027, false, false)
        } else {
            if (status === b++) {
                var a = new Array();
                for (var b = 4020000; b <= 4020008; b++) {
                    a.push(b)
                }
                for (var b = 4021000; b <= 4021016; b++) {
                    a.push(b)
                }
                for (var b = 4022000; b <= 4022021; b++) {
                    a.push(b)
                }
                for (var b = 4023000; b <= 4023026; b++) {
                    a.push(b)
                }
                for (var b = 4024000; b <= 4024007; b++) {
                    a.push(b)
                }
                for (var b = 4025000; b <= 4025011; b++) {
                    a.push(b)
                }
                im.gainItem(a[im.rand(0, a.length - 1)], im.rand(1, 30));
                im.gainItem(2431233, -1)
            }
        }
    }
};